package components.navigation.degree
{
	import org.un.cava.birdeye.qavis.treemap.controls.TreeMap;

	public class ClassTreeMap extends TreeMap
	{
		public function ClassTreeMap()
		{
			super();
		}
		
		override public function itemToWeight(item:Object):Number
		{
			if(item === null)
			{
				return 0;
			}
			
			var uid:String = this.itemToUID(item);
			var weight:Number = this._uidToWeight[uid];
			
			if(isNaN(weight))
			{
				if(this.weightFunction != null)
				{
					weight = this.weightFunction(item);
				}
				else if(item.hasOwnProperty(this.weightField))
				{
					weight = item[this.weightField];
				}
				else
				{
					weight = 0;
				}
				this._uidToWeight[uid] = weight;
			}
			return weight;
		}
	}
}